CC 		:= gcc
AR 		:= ar
CFLAGS  := -Iinclude -Llib -ltablite
LIBFLAGS:= -Iinclude
DEPS 	:= include/TabLite.h
LIBOBJS := src/TabLite.o src/TabLiteSet.o src/TabLiteGet.o src/TabLiteRemove.o
LIBOBJS += src/TabElem.o src/TabElemSet.o src/TabElemGet.o src/TabError.o

OBJS	:= main.o

src/%.o: src/%.c $(DEPS)
	$(CC) -c -o $@ $< $(LIBFLAGS)

%.o: %.c $(DEPS)
	$(CC) -c -o $@ $< $(CFLAGS)

all: lib TabLite

TabLite: $(OBJS) 
	$(CC) -o $@ $^ $(CFLAGS)

lib: $(LIBOBJS) $(DEPS)
	$(AR) -crv lib/libtablite.a $(LIBOBJS)

clean:
	rm -f src/*.o *.o TabLite